home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Experimental BBS Explossion 3
/
Experimental BBS Explossion III.iso
/
c
/
cujoct93.zip
/
1110089B
< prev
next >
Wrap
Text File
|
1993-08-10
|
408b
|
26 lines
/* stack1.c: A C implementation of a stack */
#include "stack1.h"
#define STACK_SIZE 100
static int stack[STACK_SIZE];
static int stkptr = 0;
void stack_init(void)
{
stkptr = 0;
}
int stack_push(int x)
{
return (stkptr == STACK_SIZE)
? STACK_ERROR
: (stack[stkptr++] = x);
}
int stack_pop(void)
{
return (stkptr == 0) ? STACK_ERROR : stack[--stkptr];
}